#ifndef _NE_SPRITE_H_
#define _NE_SPRITE_H_

#include <common/Object.h>
#include <mathematics/Vector4.h>

namespace ne
{
    enum SpriteType
    {
        SPT_COMMON,
        SPT_SLICED
    };

    class NEAPI Sprite : public Object
    {
        public:
            explicit Sprite(const std::string &name);

            void setSpriteType(const SpriteType spt);
            SpriteType getSpriteType() const;

            /* *---------1
               |         |
               |         |
               |         |
               |         |
               |         |
               0---------*
            */
            Vector4 getTexCoord() const;
            void setTexCoord(const Vector4 &t01);
            void setTexCoord(const Vector2 &t0, const Vector2 &t1);
            void setTexCoord(const real u0, const real v0,
                             const real u1, const real v1);
            void resetTexCoord();

            /* *--+---+--1
               |  |   |  |
               +--+---1--+
               |  |   |  |
               +--0---+--+
               |  |   |  |
               0--+---+--*
            */
            Vector4 getSlicedTexCoord() const;
            void setSlicedTexCoord(const Vector4 &t01);
            void setSlicedTexCoord(const Vector2 &t0, const Vector2 &t1);
            void setSlicedTexCoord(const real u0, const real v0,
                                   const real u1, const real v1);
            void resetSlicedTexCoord();

            virtual ~Sprite();

        private:
            Sprite(const Sprite &);

            Sprite& operator = (const Sprite &);

        public:
            static SpriteType GetSpriteType(const std::string &str);

        private:
            SpriteType mSpriteType;

        public:
            Vector2 texCoords[2];
            Vector2 slicedTexCoords[2];
    };

    typedef std::map<std::string, Sprite*> SpriteMap;
    typedef SpriteMap::iterator SpriteMapIterator;
    typedef SpriteMap::const_iterator SpriteMapConstIterator;
}

#endif
